home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / include / RCS / netUltra.h,v < prev    next >
Encoding:
Text File  |  1992-08-05  |  7.2 KB  |  300 lines

  1. head     1.5;
  2. branch   ;
  3. access   ;
  4. symbols  sprited:1.4.1;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.5
  10. date     92.08.05.16.34.54;  author jhh;  state Exp;
  11. branches ;
  12. next     1.4;
  13.  
  14. 1.4
  15. date     90.11.06.16.51.32;  author jhh;  state Exp;
  16. branches 1.4.1.1;
  17. next     1.3;
  18.  
  19. 1.3
  20. date     90.10.19.15.51.27;  author jhh;  state Exp;
  21. branches ;
  22. next     1.2;
  23.  
  24. 1.2
  25. date     90.06.21.12.48.50;  author jhh;  state Exp;
  26. branches ;
  27. next     1.1;
  28.  
  29. 1.1
  30. date     90.05.29.15.39.37;  author jhh;  state Exp;
  31. branches ;
  32. next     ;
  33.  
  34. 1.4.1.1
  35. date     91.10.21.22.16.57;  author kupfer;  state Exp;
  36. branches ;
  37. next     ;
  38.  
  39.  
  40. desc
  41. @@
  42.  
  43.  
  44. 1.5
  45. log
  46. @added compare and copy routines
  47. @
  48. text
  49. @/*
  50.  * netUltra.h --
  51.  *
  52.  *    Definitions for sending and receiving Ultranet packets.  Packets
  53.  *    are sent by putting a "Net_UltraHeader" at the start of the packet
  54.  *    then doing a write() on the Ultranet device.  Packets are read
  55.  *    by doing a read.
  56.  *
  57.  * Copyright 1990 Regents of the University of California
  58.  * Permission to use, copy, modify, and distribute this
  59.  * software and its documentation for any purpose and without
  60.  * fee is hereby granted, provided that the above copyright
  61.  * notice appear in all copies.  The University of California
  62.  * makes no representations about the suitability of this
  63.  * software for any purpose.  It is provided "as is" without
  64.  * express or implied warranty.
  65.  *
  66.  * $Header: /sprite/src/lib/include/RCS/netUltra.h,v 1.4 90/11/06 16:51:32 jhh Exp Locker: jhh $ SPRITE (Berkeley)
  67.  */
  68.  
  69. #ifndef _NETULTRA
  70. #define _NETULTRA
  71.  
  72. #include "sprite.h"
  73. #include "machparam.h"
  74.  
  75. /*
  76.  * The following macros are used to manipulate an Ultranet address.
  77.  */
  78.  
  79. #define Net_UltraAddressSet(addrPtr, group, unit) {         \
  80.     ((unsigned char *) (addrPtr))[4] = (group) >> 2;         \
  81.     ((unsigned char *) (addrPtr))[5] = ((group) << 6) | (unit); \
  82.     ((unsigned char *) (addrPtr))[1] = 0x49;            \
  83.     ((unsigned char *) (addrPtr))[6] = 0xfe;            \
  84. }
  85.  
  86. #define Net_UltraAddressGet(addrPtr, groupPtr, unitPtr) {     \
  87.     *(groupPtr) = (((unsigned char *) (addrPtr))[4] << 2) |     \
  88.           (((unsigned char *) (addrPtr))[5] >> 6);     \
  89.     *(unitPtr) = (((unsigned char *) (addrPtr))[5] & 0x3f);     \
  90. }
  91.  
  92.  
  93. /*
  94.  * Definition of an Ultranet address.
  95.  */
  96. typedef struct Net_UltraAddress {
  97.     char        data[8];
  98. } Net_UltraAddress;
  99.  
  100. #define Net_UltraAddrCmp(a,b) \
  101.     (!(((a).data[4] == (b).data[4]) && ((a).data[5] == (b).data[5])))
  102.  
  103. #define Net_UltraAddrCopy(src, dest) ((dest) = (src))
  104.  
  105. /*
  106.  * Ultranet Transport Layer Address Format.  This structure is used in
  107.  * the various request blocks that are sent to the adapter.
  108.  * Here are a few tips on filling this in.  The "addressSize" is 7.
  109.  * TSAP stands for "Transport Service Access Point".  The standard
  110.  * Ultranet software sets the size to 2 and puts the port in the TSAP.
  111.  * You'll have to follow suit if you want to write to a particular port
  112.  * on a Unix machine with an Ultranet.  On Sprite: the "localAddress" field of
  113.  * the header you just set the tsapSize to 2, and zero out the tsap.
  114.  * For the "remoteAddress" you should set the tsapSize to 2, and tsap[0] 
  115.  * and tsap[1] to something either than {0,0} and {0xff, 0xff}.
  116.  * Use the above macros to set the "address" field.
  117.  */
  118.  
  119. #define NET_ULTRA_ADDR_SIZE        7 /* Value for "addressSize". */
  120. #define NET_ULTRA_TSAP_SIZE        4 /* Size of the TSAP. */
  121.  
  122. typedef struct Net_UltraTLAddress {
  123.     unsigned char    addressSize;    /* Size of the address field. */
  124.     unsigned char    tsapSize;    /* NET_ULTRA_TSAP_SIZE */
  125.     unsigned char    tsap[4];    /* The TSAP, whatever that is. */
  126.     Net_UltraAddress    address;    /* The network address. */
  127.     char        pad[2];        /* Pad this out to 16 bytes. */
  128. } Net_UltraTLAddress;
  129.  
  130. /*
  131.  * A "wildcard" transport layer address that matches any address. 
  132.  * This can be used in the "localAddress" field, as well as to initialize
  133.  * Net_UltraTLAddress structures before filling them in.
  134.  */
  135.  
  136. #define Net_UltraTLWildcard(addrPtr) {                \
  137.     bzero((char *) (addrPtr), sizeof(Net_UltraTLAddress));    \
  138.     (addrPtr)->addressSize = 7;                    \
  139.     (addrPtr)->tsapSize = 4;                    \
  140. }
  141.  
  142. /*
  143.  * Header on ultranet packets. If you want to use any of the fields other
  144.  * than the remote and local address you should look at the file
  145.  * "kernel/netUltra.h".  Those fields marked "unused" do not need to be
  146.  * used to send packets to or receive packets from the net device and must
  147.  * be set to zero.  Your best bet is to bzero the header before filling
  148.  * it in.
  149.  */
  150.  
  151. typedef struct Net_UltraHeader {
  152.     unsigned char    cmd;        /* Unused. */
  153.     unsigned char    status;        /* Unused. */
  154.     unsigned short    reference;    /* Unused. */
  155.     int            foo;        /* Unused. */
  156.     Address        buffer;        /* Unused. */
  157.     int            size;        /* Unused. */
  158.     Net_UltraTLAddress    remoteAddress;    /* Address of remote host. */
  159.     Net_UltraTLAddress    localAddress;    /* Address of local host. */
  160.     unsigned short    options;    /* Unused. */
  161.     unsigned short    quality;    /* Unused. */
  162.     unsigned int    pad3;
  163. } Net_UltraHeader;
  164.  
  165. /*
  166.  * Minimum and maximum Ultranet packet sizes (including the Net_UltraHeader).
  167.  */
  168.  
  169. #define NET_ULTRA_MIN_BYTES     0
  170. #define NET_ULTRA_MAX_BYTES     (32768 + sizeof(Net_UltraHeader))
  171.  
  172. #endif /* _NETULTRA */
  173.  
  174. @
  175.  
  176.  
  177. 1.4
  178. log
  179. @more features
  180. @
  181. text
  182. @d18 1
  183. a18 1
  184.  * $Header: /sprite/src/lib/include/RCS/netUltra.h,v 1.3 90/10/19 15:51:27 jhh Exp Locker: jhh $ SPRITE (Berkeley)
  185. d44 1
  186. d51 5
  187. @
  188.  
  189.  
  190. 1.4.1.1
  191. log
  192. @Initial branch for Sprite server.
  193. @
  194. text
  195. @d18 1
  196. a18 1
  197.  * $Header: /sprite/src/lib/include/RCS/netUltra.h,v 1.4 90/11/06 16:51:32 jhh Exp $ SPRITE (Berkeley)
  198. @
  199.  
  200.  
  201. 1.3
  202. log
  203. @got rid of bit fields
  204. @
  205. text
  206. @d4 4
  207. a7 1
  208.  *    Definitions for the Ultranet.
  209. d18 1
  210. a18 1
  211.  * $Header: /sprite/src/lib/include/RCS/netUltra.h,v 1.2 90/06/21 12:48:50 jhh Exp Locker: jhh $ SPRITE (Berkeley)
  212. d27 4
  213. d34 2
  214. d44 3
  215. d54 9
  216. d65 2
  217. a66 1
  218. #define NET_ULTRA_TSAP_SIZE        4 /* Size of the mysterious TSAP. */
  219. d71 1
  220. a71 1
  221.     char        tsap[4];    /* The TSAP, whatever that is. */
  222. d77 12
  223. d92 3
  224. a94 1
  225.  * used to send packets to or receive packets from the net device.
  226. d112 1
  227. a112 1
  228.  * Minimum and maximum Ultranet packet sizes.
  229. d116 1
  230. a116 1
  231. #define NET_ULTRA_MAX_BYTES     (32768 + sizeof(NetUltraDatagramRequest))
  232. @
  233.  
  234.  
  235. 1.2
  236. log
  237. @initial ultra support
  238. @
  239. text
  240. @d15 1
  241. a15 1
  242.  * $Header: /sprite/src/lib/include/RCS/netUltra.h,v 1.1 90/05/29 15:39:37 jhh Exp Locker: jhh $ SPRITE (Berkeley)
  243. d21 1
  244. d24 4
  245. a27 1
  246. #if (BYTE_ORDER == BIG_ENDIAN)
  247. d29 5
  248. a33 8
  249. typedef struct Net_UltraAddress {
  250.     char        pad1[4];    /* Adjust the following fields to
  251.                      * where the adapter expects them. */
  252.     unsigned int    group:10;    /* The adapter group. */
  253.     unsigned int    unit:6;        /* The unit number. */
  254.     char        pad2[2];    /* Make it the same size as a 
  255.                      * Net_Address. */
  256. } Net_UltraAddress;
  257. a34 2
  258. #else
  259.  
  260. d36 1
  261. a36 6
  262.     char        pad1[4];    /* Adjust the following fields to
  263.                      * where the adapter expects them. */
  264.     unsigned int    unit:6;        /* The unit number. */
  265.     unsigned int    group:10;    /* The adapter group. */
  266.     char        pad2[2];    /* Make it the same size as a 
  267.                      * Net_Address. */
  268. a38 2
  269. #endif
  270.  
  271. d51 1
  272. a68 1
  273.     unsigned short    pad1;
  274. a69 1
  275.     unsigned short    pad2;
  276. @
  277.  
  278.  
  279. 1.1
  280. log
  281. @Initial revision
  282. @
  283. text
  284. @d15 1
  285. a15 1
  286.  * $Header: /sprite/lib/forms/RCS/proto.h,v 1.5 90/01/12 12:03:25 douglis Exp $ SPRITE (Berkeley)
  287. d26 2
  288. a27 1
  289.     char        pad[2];        /* Pad this out to a word. */
  290. d30 2
  291. d37 2
  292. d41 2
  293. a42 1
  294.     char        pad[2];        /* Pad this out to a word. */
  295. d48 37
  296. d89 1
  297. a89 1
  298. #define NET_ULTRA_MAX_BYTES     32768
  299. @
  300.